﻿namespace IPTableAdapters
{
    using System;
    using System.CodeDom.Compiler;
    using System.ComponentModel;
    using System.ComponentModel.Design;
    using System.Configuration;
    using System.Data;
    using System.Data.Common;
    using System.Data.SqlClient;
    using System.Diagnostics;

    [GeneratedCode("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"), Designer("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), HelpKeyword("vs.data.TableAdapter"), DesignerCategory("code"), ToolboxItem(true), DataObject(true)]
    public class ProjectGroupTableAdapter : Component
    {
        private SqlDataAdapter _adapter;
        private bool _clearBeforeFill;
        private SqlCommand[] _commandCollection;
        private SqlConnection _connection;

        /*[DebuggerNonUserCode]*/
        public ProjectGroupTableAdapter()
        {
            this.ClearBeforeFill = true;
        }

        [DataObjectMethod(DataObjectMethodType.Delete, true), DebuggerNonUserCode, HelpKeyword("vs.data.TableAdapter")]
        public virtual int Delete(bool IsDelete, string DeleteBy, string DeleteIP, string Original_ProjectGroupID)
        {
            int ret;

            this.Adapter.DeleteCommand.Parameters[0].Value = IsDelete;

            if (DeleteBy == null)
            {
                throw new ArgumentNullException("DeleteBy");
            }
            this.Adapter.DeleteCommand.Parameters[1].Value = DeleteBy;

            if (DeleteIP == null)
            {
                this.Adapter.DeleteCommand.Parameters[2].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.DeleteCommand.Parameters[2].Value = DeleteIP;
            }

            if (Original_ProjectGroupID == null)
            {
                throw new ArgumentNullException("Original_ProjectGroupID");
            }
            this.Adapter.DeleteCommand.Parameters[3].Value = Original_ProjectGroupID;
            ConnectionState previousConnectionState = this.Adapter.DeleteCommand.Connection.State;
            if ((this.Adapter.DeleteCommand.Connection.State & ConnectionState.Open) != ConnectionState.Open)
            {
                this.Adapter.DeleteCommand.Connection.Open();
            }
            try
            {
                ret = this.Adapter.DeleteCommand.ExecuteNonQuery();
            }
            finally
            {
                if (previousConnectionState == ConnectionState.Closed)
                {
                    this.Adapter.DeleteCommand.Connection.Close();
                }
            }
            return ret;
        }

        [HelpKeyword("vs.data.TableAdapter"), DebuggerNonUserCode, DataObjectMethod(DataObjectMethodType.Select, true)]
        public virtual IP.ProjectGroupDataTable dtProjectGroup(bool SuperUser, string OwnerGroupID)
        {
            this.Adapter.SelectCommand = this.CommandCollection[0];
            this.Adapter.SelectCommand.Parameters[0].Value = SuperUser;
            if (OwnerGroupID == null)
            {
                throw new ArgumentNullException("OwnerGroupID");
            }
            this.Adapter.SelectCommand.Parameters[1].Value = OwnerGroupID;
            IP.ProjectGroupDataTable dataTable = new IP.ProjectGroupDataTable();
            this.Adapter.Fill(dataTable);
            return dataTable;
        }

        [DebuggerNonUserCode, HelpKeyword("vs.data.TableAdapter"), DataObjectMethod(DataObjectMethodType.Select, false)]
        public virtual IP.ProjectGroupDataTable GetProjectGroupFromSearch(string ProjectGroupID, string Description, string OfficerName, DateTime? CreateDate, DateTime? CreateDateEnding, string Applicant, string Inventor, string Type, string TitleSubject, string Client, bool? SuperUser, string OwnerGroupId)
        {
            this.Adapter.SelectCommand = this.CommandCollection[1];
            if (ProjectGroupID == null)
            {
                this.Adapter.SelectCommand.Parameters[1].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[1].Value = ProjectGroupID;
            }
            if (Description == null)
            {
                this.Adapter.SelectCommand.Parameters[2].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[2].Value = Description;
            }
            if (OfficerName == null)
            {
                this.Adapter.SelectCommand.Parameters[3].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[3].Value = OfficerName;
            }
            if (CreateDate.HasValue)
            {
                this.Adapter.SelectCommand.Parameters[4].Value = CreateDate.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[4].Value = DBNull.Value;
            }
            if (CreateDateEnding.HasValue)
            {
                this.Adapter.SelectCommand.Parameters[5].Value = CreateDateEnding.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[5].Value = DBNull.Value;
            }
            if (Applicant == null)
            {
                this.Adapter.SelectCommand.Parameters[6].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[6].Value = Applicant;
            }
            if (Inventor == null)
            {
                this.Adapter.SelectCommand.Parameters[7].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[7].Value = Inventor;
            }
            if (Type == null)
            {
                this.Adapter.SelectCommand.Parameters[8].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[8].Value = Type;
            }
            if (TitleSubject == null)
            {
                this.Adapter.SelectCommand.Parameters[9].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[9].Value = TitleSubject;
            }
            if (Client == null)
            {
                this.Adapter.SelectCommand.Parameters[10].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[10].Value = Client;
            }
            if (SuperUser.HasValue)
            {
                this.Adapter.SelectCommand.Parameters[11].Value = SuperUser.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[11].Value = DBNull.Value;
            }
            if (OwnerGroupId == null)
            {
                this.Adapter.SelectCommand.Parameters[12].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[12].Value = OwnerGroupId;
            }
            IP.ProjectGroupDataTable dataTable = new IP.ProjectGroupDataTable();
            this.Adapter.Fill(dataTable);
            return dataTable;
        }

        [DebuggerNonUserCode, HelpKeyword("vs.data.TableAdapter"), DataObjectMethod(DataObjectMethodType.Select, false)]
        public virtual IP.ProjectGroupDataTable GetProjectGroupFromSearchAndIsDelete(string ProjectGroupID, string Description, string OfficerName, DateTime? CreateDate, DateTime? CreateDateEnding, string Applicant, string Inventor, string Type, string TitleSubject, string Client, bool? SuperUser, string OwnerGroupId, bool? IsDelete)
        {
            this.Adapter.SelectCommand = this.CommandCollection[2];
            if (ProjectGroupID == null)
            {
                this.Adapter.SelectCommand.Parameters[1].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[1].Value = ProjectGroupID;
            }
            if (Description == null)
            {
                this.Adapter.SelectCommand.Parameters[2].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[2].Value = Description;
            }
            if (OfficerName == null)
            {
                this.Adapter.SelectCommand.Parameters[3].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[3].Value = OfficerName;
            }
            if (CreateDate.HasValue)
            {
                this.Adapter.SelectCommand.Parameters[4].Value = CreateDate.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[4].Value = DBNull.Value;
            }
            if (CreateDateEnding.HasValue)
            {
                this.Adapter.SelectCommand.Parameters[5].Value = CreateDateEnding.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[5].Value = DBNull.Value;
            }
            if (Applicant == null)
            {
                this.Adapter.SelectCommand.Parameters[6].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[6].Value = Applicant;
            }
            if (Inventor == null)
            {
                this.Adapter.SelectCommand.Parameters[7].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[7].Value = Inventor;
            }
            if (Type == null)
            {
                this.Adapter.SelectCommand.Parameters[8].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[8].Value = Type;
            }
            if (TitleSubject == null)
            {
                this.Adapter.SelectCommand.Parameters[9].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[9].Value = TitleSubject;
            }
            if (Client == null)
            {
                this.Adapter.SelectCommand.Parameters[10].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[10].Value = Client;
            }
            if (SuperUser.HasValue)
            {
                this.Adapter.SelectCommand.Parameters[11].Value = SuperUser.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[11].Value = DBNull.Value;
            }
            if (OwnerGroupId == null)
            {
                this.Adapter.SelectCommand.Parameters[12].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[12].Value = OwnerGroupId;
            }

            if (IsDelete.HasValue)
            {
                this.Adapter.SelectCommand.Parameters[13].Value = IsDelete.Value;
            }
            else
            {
                this.Adapter.SelectCommand.Parameters[13].Value = DBNull.Value;
            }

            IP.ProjectGroupDataTable dataTable = new IP.ProjectGroupDataTable();
            this.Adapter.Fill(dataTable);
            return dataTable;
        }

        /*[DebuggerNonUserCode]*/
        private void InitAdapter()
        {
            this._adapter = new SqlDataAdapter();
            DataTableMapping tableMapping = new DataTableMapping();
            tableMapping.SourceTable = "Table";
            tableMapping.DataSetTable = "ProjectGroup";
            tableMapping.ColumnMappings.Add("ProjectGroupID", "ProjectGroupID");
            tableMapping.ColumnMappings.Add("Description", "Description");
            tableMapping.ColumnMappings.Add("OfficerName", "OfficerName");
            tableMapping.ColumnMappings.Add("OfficerRole", "OfficerRole");
            tableMapping.ColumnMappings.Add("Title", "Title");
            tableMapping.ColumnMappings.Add("OfficerEmail", "OfficerEmail");
            tableMapping.ColumnMappings.Add("CreateBy", "CreateBy");
            tableMapping.ColumnMappings.Add("CreateDate", "CreateDate");
            tableMapping.ColumnMappings.Add("UpdateBy", "UpdateBy");
            tableMapping.ColumnMappings.Add("UpdateDate", "UpdateDate");
            tableMapping.ColumnMappings.Add("OwnerGroupID", "OwnerGroupID");
            tableMapping.ColumnMappings.Add("FirstFilingDate", "FirstFilingDate");
            tableMapping.ColumnMappings.Add("PriorityDate", "PriorityDate");
            tableMapping.ColumnMappings.Add("ProjectClass", "ProjectClass");
            tableMapping.ColumnMappings.Add("Applicant", "Applicant");
            tableMapping.ColumnMappings.Add("Inventor", "Inventor");
            tableMapping.ColumnMappings.Add("Type", "Type");
            tableMapping.ColumnMappings.Add("Client", "Client");
            tableMapping.ColumnMappings.Add("CreateIP", "CreateIP");
            tableMapping.ColumnMappings.Add("UpdateIP", "UpdateIP");
            tableMapping.ColumnMappings.Add("IsDelete", "IsDelete");
            tableMapping.ColumnMappings.Add("DeleteBy", "DeleteBy");
            tableMapping.ColumnMappings.Add("DeleteIP", "DeleteIP");
            this._adapter.TableMappings.Add(tableMapping);
            this._adapter.DeleteCommand = new SqlCommand();
            this._adapter.DeleteCommand.Connection = this.Connection;
            //this._adapter.DeleteCommand.CommandText = "DELETE FROM [ProjectGroup] WHERE (([ProjectGroupID] = @Original_ProjectGroupID))";
            this._adapter.DeleteCommand.CommandText = "UPDATE [ProjectGroup] SET IsDelete = @IsDelete,DeleteBy = @DeleteBy,DeleteDate = GETDATE(), DeleteIP = @DeleteIP WHERE (([ProjectGroupID] = @Original_ProjectGroupID))";
            this._adapter.DeleteCommand.CommandType = CommandType.Text;
            this._adapter.DeleteCommand.Parameters.Add(new SqlParameter("@IsDelete", SqlDbType.Bit, 1, ParameterDirection.Input, 0, 0, "IsDelete", DataRowVersion.Original, false, null, "", "", ""));
            this._adapter.DeleteCommand.Parameters.Add(new SqlParameter("@DeleteBy", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "DeleteBy", DataRowVersion.Original, false, null, "", "", ""));
            this._adapter.DeleteCommand.Parameters.Add(new SqlParameter("@DeleteIP", SqlDbType.NVarChar, 50, ParameterDirection.Input, 0, 0, "DeleteIP", DataRowVersion.Original, false, null, "", "", ""));
            this._adapter.DeleteCommand.Parameters.Add(new SqlParameter("@Original_ProjectGroupID", SqlDbType.NVarChar, 0, ParameterDirection.Input, 0, 0, "ProjectGroupID", DataRowVersion.Original, false, null, "", "", ""));
            this._adapter.InsertCommand = new SqlCommand();
            this._adapter.InsertCommand.Connection = this.Connection;
            this._adapter.InsertCommand.CommandText = "INSERT INTO ProjectGroup\r\n                      (ProjectGroupID, Description, OfficerName, OfficerRole, Title, OfficerEmail, CreateBy, UpdateBy, OwnerGroupID, FirstFilingDate, PriorityDate, \r\n                      ProjectClass, Applicant, Inventor, Type, Client, TitleSubject, CreateIP)\r\nVALUES     (@ProjectGroupID,@Description,@OfficerName,@OfficerRole,@Title,@OfficerEmail,@CreateBy,@UpdateBy,@OwnerGroupID,@FirstFilingDate,@PriorityDate,@ProjectClass,@Applicant,@Inventor,@Type,@Client,@TitleSubject, @CreateIP)";
            this._adapter.InsertCommand.CommandType = CommandType.Text;
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@ProjectGroupID", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ProjectGroupID", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Description", SqlDbType.NVarChar, 200, ParameterDirection.Input, 0, 0, "Description", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@OfficerName", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "OfficerName", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@OfficerRole", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "OfficerRole", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Title", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "Title", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@OfficerEmail", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "OfficerEmail", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@CreateBy", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "CreateBy", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@UpdateBy", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "UpdateBy", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@OwnerGroupID", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "OwnerGroupID", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@FirstFilingDate", SqlDbType.DateTime, 8, ParameterDirection.Input, 0, 0, "FirstFilingDate", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@PriorityDate", SqlDbType.DateTime, 8, ParameterDirection.Input, 0, 0, "PriorityDate", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@ProjectClass", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ProjectClass", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Applicant", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "Applicant", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Inventor", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "Inventor", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Type", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "Type", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Client", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "Client", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@TitleSubject", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "TitleSubject", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@CreateIP", SqlDbType.NVarChar, 50, ParameterDirection.Input, 0, 0, "CreateIP", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand = new SqlCommand();
            this._adapter.UpdateCommand.Connection = this.Connection;
            this._adapter.UpdateCommand.CommandText = "UPDATE    ProjectGroup\r\nSET              ProjectGroupID = @ProjectGroupID, Description = @Description, OfficerName = @OfficerName, OfficerRole = @OfficerRole, Title = @Title, \r\n                      OfficerEmail = @OfficerEmail, UpdateBy = @UpdateBy, UpdateDate = GETDATE(), FirstFilingDate = @FirstFilingDate, PriorityDate = @PriorityDate, ProjectClass = @ProjectClass, \r\n                      Applicant = @Applicant, Inventor = @Inventor, Type = @Type, Client = @Client, TitleSubject = @TitleSubject, UpdateIP = @UpdateIP \r\nWHERE     (ProjectGroupID = @Original_ProjectGroupID)";
            this._adapter.UpdateCommand.CommandType = CommandType.Text;
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@ProjectGroupID", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ProjectGroupID", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Description", SqlDbType.NVarChar, 200, ParameterDirection.Input, 0, 0, "Description", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@OfficerName", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "OfficerName", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@OfficerRole", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "OfficerRole", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Title", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "Title", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@OfficerEmail", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "OfficerEmail", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@UpdateBy", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "UpdateBy", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@FirstFilingDate", SqlDbType.DateTime, 8, ParameterDirection.Input, 0, 0, "FirstFilingDate", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@PriorityDate", SqlDbType.DateTime, 8, ParameterDirection.Input, 0, 0, "PriorityDate", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@ProjectClass", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ProjectClass", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Applicant", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "Applicant", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Inventor", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "Inventor", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Type", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "Type", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Client", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "Client", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@TitleSubject", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "TitleSubject", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@UpdateIP", SqlDbType.NVarChar, 50, ParameterDirection.Input, 0, 0, "UpdateIP", DataRowVersion.Current, false, null, "", "", ""));
            this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Original_ProjectGroupID", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "ProjectGroupID", DataRowVersion.Original, false, null, "", "", ""));
        }

        /*[DebuggerNonUserCode]*/
        private void InitCommandCollection()
        {
            this._commandCollection = new SqlCommand[3];
            this._commandCollection[0] = new SqlCommand();
            this._commandCollection[0].Connection = this.Connection;
            this._commandCollection[0].CommandText = "SELECT     ProjectGroupID, Description, OfficerName, OfficerRole, Title, OfficerEmail, CreateBy, CreateDate, UpdateBy, UpdateDate, OwnerGroupID, \r\n                      FirstFilingDate, PriorityDate, ProjectClass, Applicant, Inventor, Type, Client\r\nFROM         ProjectGroup\r\nWHERE     (@SuperUser = 1) OR\r\n                      (OwnerGroupID = @OwnerGroupID  AND IsDelete = 0 )";
            this._commandCollection[0].CommandType = CommandType.Text;
            this._commandCollection[0].Parameters.Add(new SqlParameter("@SuperUser", SqlDbType.Bit, 0x400, ParameterDirection.Input, 0, 0, "", DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[0].Parameters.Add(new SqlParameter("@OwnerGroupID", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, "OwnerGroupID", DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[1] = new SqlCommand();
            this._commandCollection[1].Connection = this.Connection;
            this._commandCollection[1].CommandText = "dbo.GetProjectGroupSearchResultSp";
            this._commandCollection[1].CommandType = CommandType.StoredProcedure;
            this._commandCollection[1].Parameters.Add(new SqlParameter("@RETURN_VALUE", SqlDbType.Int, 4, ParameterDirection.ReturnValue, 10, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[1].Parameters.Add(new SqlParameter("@ProjectGroupID", SqlDbType.NVarChar, 30, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[1].Parameters.Add(new SqlParameter("@Description", SqlDbType.NVarChar, 100, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[1].Parameters.Add(new SqlParameter("@OfficerName", SqlDbType.NVarChar, 30, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[1].Parameters.Add(new SqlParameter("@CreateDate", SqlDbType.DateTime, 8, ParameterDirection.Input, 0x17, 3, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[1].Parameters.Add(new SqlParameter("@CreateDateEnding", SqlDbType.DateTime, 8, ParameterDirection.Input, 0x17, 3, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[1].Parameters.Add(new SqlParameter("@Applicant", SqlDbType.NVarChar, 30, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[1].Parameters.Add(new SqlParameter("@Inventor", SqlDbType.NVarChar, 30, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[1].Parameters.Add(new SqlParameter("@Type", SqlDbType.NVarChar, 30, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[1].Parameters.Add(new SqlParameter("@TitleSubject", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[1].Parameters.Add(new SqlParameter("@Client", SqlDbType.NVarChar, 30, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[1].Parameters.Add(new SqlParameter("@SuperUser", SqlDbType.Bit, 1, ParameterDirection.Input, 1, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[1].Parameters.Add(new SqlParameter("@OwnerGroupId", SqlDbType.NVarChar, 30, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));

            this._commandCollection[2] = new SqlCommand();
            this._commandCollection[2].Connection = this.Connection;
            this._commandCollection[2].CommandText = "dbo.GetProjectGroupSearchAndIsDeleteSp";
            this._commandCollection[2].CommandType = CommandType.StoredProcedure;
            this._commandCollection[2].Parameters.Add(new SqlParameter("@RETURN_VALUE", SqlDbType.Int, 4, ParameterDirection.ReturnValue, 10, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[2].Parameters.Add(new SqlParameter("@ProjectGroupID", SqlDbType.NVarChar, 30, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[2].Parameters.Add(new SqlParameter("@Description", SqlDbType.NVarChar, 100, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[2].Parameters.Add(new SqlParameter("@OfficerName", SqlDbType.NVarChar, 30, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[2].Parameters.Add(new SqlParameter("@CreateDate", SqlDbType.DateTime, 8, ParameterDirection.Input, 0x17, 3, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[2].Parameters.Add(new SqlParameter("@CreateDateEnding", SqlDbType.DateTime, 8, ParameterDirection.Input, 0x17, 3, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[2].Parameters.Add(new SqlParameter("@Applicant", SqlDbType.NVarChar, 30, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[2].Parameters.Add(new SqlParameter("@Inventor", SqlDbType.NVarChar, 30, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[2].Parameters.Add(new SqlParameter("@Type", SqlDbType.NVarChar, 30, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[2].Parameters.Add(new SqlParameter("@TitleSubject", SqlDbType.NVarChar, 60, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[2].Parameters.Add(new SqlParameter("@Client", SqlDbType.NVarChar, 30, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[2].Parameters.Add(new SqlParameter("@SuperUser", SqlDbType.Bit, 1, ParameterDirection.Input, 1, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[2].Parameters.Add(new SqlParameter("@OwnerGroupId", SqlDbType.NVarChar, 30, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));
            this._commandCollection[2].Parameters.Add(new SqlParameter("@IsDelete", SqlDbType.Bit, 1, ParameterDirection.Input, 0, 0, null, DataRowVersion.Current, false, null, "", "", ""));

        }

        /*[DebuggerNonUserCode]*/
        private void InitConnection()
        {
            this._connection = new SqlConnection();
            this._connection.ConnectionString = ConfigurationManager.ConnectionStrings["LocalSqlConnection1"].ConnectionString;
        }

        [DebuggerNonUserCode, DataObjectMethod(DataObjectMethodType.Insert, true), HelpKeyword("vs.data.TableAdapter")]
        public virtual int Insert(string ProjectGroupID, string Description, string OfficerName, string OfficerRole, string Title, string OfficerEmail, string CreateBy, string UpdateBy, string OwnerGroupID, DateTime? FirstFilingDate, DateTime? PriorityDate, string ProjectClass, string Applicant, string Inventor, string Type, string Client, string TitleSubject, string CreateIP)
        {
            int ret;
            if (ProjectGroupID == null)
            {
                throw new ArgumentNullException("ProjectGroupID");
            }
            this.Adapter.InsertCommand.Parameters[0].Value = ProjectGroupID;
            if (Description == null)
            {
                this.Adapter.InsertCommand.Parameters[1].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[1].Value = Description;
            }
            if (OfficerName == null)
            {
                throw new ArgumentNullException("OfficerName");
            }
            this.Adapter.InsertCommand.Parameters[2].Value = OfficerName;
            if (OfficerRole == null)
            {
                this.Adapter.InsertCommand.Parameters[3].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[3].Value = OfficerRole;
            }
            if (Title == null)
            {
                this.Adapter.InsertCommand.Parameters[4].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[4].Value = Title;
            }
            if (OfficerEmail == null)
            {
                this.Adapter.InsertCommand.Parameters[5].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[5].Value = OfficerEmail;
            }
            if (CreateBy == null)
            {
                throw new ArgumentNullException("CreateBy");
            }
            this.Adapter.InsertCommand.Parameters[6].Value = CreateBy;
            if (UpdateBy == null)
            {
                throw new ArgumentNullException("UpdateBy");
            }
            this.Adapter.InsertCommand.Parameters[7].Value = UpdateBy;
            if (OwnerGroupID == null)
            {
                throw new ArgumentNullException("OwnerGroupID");
            }
            this.Adapter.InsertCommand.Parameters[8].Value = OwnerGroupID;
            if (FirstFilingDate.HasValue)
            {
                this.Adapter.InsertCommand.Parameters[9].Value = FirstFilingDate.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[9].Value = DBNull.Value;
            }
            if (PriorityDate.HasValue)
            {
                this.Adapter.InsertCommand.Parameters[10].Value = PriorityDate.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[10].Value = DBNull.Value;
            }
            if (ProjectClass == null)
            {
                this.Adapter.InsertCommand.Parameters[11].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[11].Value = ProjectClass;
            }
            if (Applicant == null)
            {
                this.Adapter.InsertCommand.Parameters[12].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[12].Value = Applicant;
            }
            if (Inventor == null)
            {
                this.Adapter.InsertCommand.Parameters[13].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[13].Value = Inventor;
            }
            if (Type == null)
            {
                this.Adapter.InsertCommand.Parameters[14].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[14].Value = Type;
            }
            if (Client == null)
            {
                this.Adapter.InsertCommand.Parameters[15].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[15].Value = Client;
            }
            if (TitleSubject == null)
            {
                this.Adapter.InsertCommand.Parameters[0x10].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[0x10].Value = TitleSubject;
            }
            if (CreateIP == null)
            {
                this.Adapter.InsertCommand.Parameters[17].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.InsertCommand.Parameters[17].Value = CreateIP;
            }

            ConnectionState previousConnectionState = this.Adapter.InsertCommand.Connection.State;
            if ((this.Adapter.InsertCommand.Connection.State & ConnectionState.Open) != ConnectionState.Open)
            {
                this.Adapter.InsertCommand.Connection.Open();
            }
            try
            {
                ret = this.Adapter.InsertCommand.ExecuteNonQuery();
            }
            finally
            {
                if (previousConnectionState == ConnectionState.Closed)
                {
                    this.Adapter.InsertCommand.Connection.Close();
                }
            }
            return ret;
        }

        [HelpKeyword("vs.data.TableAdapter"), DebuggerNonUserCode]
        public virtual int Update(IP dataSet)
        {
            return this.Adapter.Update(dataSet, "ProjectGroup");
        }

        [DebuggerNonUserCode, HelpKeyword("vs.data.TableAdapter")]
        public virtual int Update(DataRow[] dataRows)
        {
            return this.Adapter.Update(dataRows);
        }

        [DebuggerNonUserCode, HelpKeyword("vs.data.TableAdapter")]
        public virtual int Update(IP.ProjectGroupDataTable dataTable)
        {
            return this.Adapter.Update(dataTable);
        }

        [DebuggerNonUserCode, HelpKeyword("vs.data.TableAdapter")]
        public virtual int Update(DataRow dataRow)
        {
            return this.Adapter.Update(new DataRow[] { dataRow });
        }

        [DebuggerNonUserCode, HelpKeyword("vs.data.TableAdapter"), DataObjectMethod(DataObjectMethodType.Update, true)]
        public virtual int Update(string ProjectGroupID, string Description, string OfficerName, string OfficerRole, string Title, string OfficerEmail, string UpdateBy, DateTime? FirstFilingDate, DateTime? PriorityDate, string ProjectClass, string Applicant, string Inventor, string Type, string Client, string TitleSubject, string UpdateIP, string Original_ProjectGroupID)
        {
            int ret;
            if (ProjectGroupID == null)
            {
                throw new ArgumentNullException("ProjectGroupID");
            }
            this.Adapter.UpdateCommand.Parameters[0].Value = ProjectGroupID;
            if (Description == null)
            {
                this.Adapter.UpdateCommand.Parameters[1].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[1].Value = Description;
            }
            if (OfficerName == null)
            {
                throw new ArgumentNullException("OfficerName");
            }
            this.Adapter.UpdateCommand.Parameters[2].Value = OfficerName;
            if (OfficerRole == null)
            {
                this.Adapter.UpdateCommand.Parameters[3].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[3].Value = OfficerRole;
            }
            if (Title == null)
            {
                this.Adapter.UpdateCommand.Parameters[4].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[4].Value = Title;
            }
            if (OfficerEmail == null)
            {
                this.Adapter.UpdateCommand.Parameters[5].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[5].Value = OfficerEmail;
            }
            if (UpdateBy == null)
            {
                throw new ArgumentNullException("UpdateBy");
            }
            this.Adapter.UpdateCommand.Parameters[6].Value = UpdateBy;
            if (FirstFilingDate.HasValue)
            {
                this.Adapter.UpdateCommand.Parameters[7].Value = FirstFilingDate.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[7].Value = DBNull.Value;
            }
            if (PriorityDate.HasValue)
            {
                this.Adapter.UpdateCommand.Parameters[8].Value = PriorityDate.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[8].Value = DBNull.Value;
            }
            if (ProjectClass == null)
            {
                this.Adapter.UpdateCommand.Parameters[9].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[9].Value = ProjectClass;
            }
            if (Applicant == null)
            {
                this.Adapter.UpdateCommand.Parameters[10].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[10].Value = Applicant;
            }
            if (Inventor == null)
            {
                this.Adapter.UpdateCommand.Parameters[11].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[11].Value = Inventor;
            }
            if (Type == null)
            {
                this.Adapter.UpdateCommand.Parameters[12].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[12].Value = Type;
            }
            if (Client == null)
            {
                this.Adapter.UpdateCommand.Parameters[13].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[13].Value = Client;
            }
            if (TitleSubject == null)
            {
                this.Adapter.UpdateCommand.Parameters[14].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[14].Value = TitleSubject;
            }
            if (UpdateIP == null)
            {
                this.Adapter.UpdateCommand.Parameters[15].Value = DBNull.Value;
            }
            else
            {
                this.Adapter.UpdateCommand.Parameters[15].Value = UpdateIP;
            }
            if (Original_ProjectGroupID == null)
            {
                throw new ArgumentNullException("Original_ProjectGroupID");
            }
            this.Adapter.UpdateCommand.Parameters[16].Value = Original_ProjectGroupID;
            ConnectionState previousConnectionState = this.Adapter.UpdateCommand.Connection.State;
            if ((this.Adapter.UpdateCommand.Connection.State & ConnectionState.Open) != ConnectionState.Open)
            {
                this.Adapter.UpdateCommand.Connection.Open();
            }
            try
            {
                ret = this.Adapter.UpdateCommand.ExecuteNonQuery();
            }
            finally
            {
                if (previousConnectionState == ConnectionState.Closed)
                {
                    this.Adapter.UpdateCommand.Connection.Close();
                }
            }
            return ret;
        }

        /*[DebuggerNonUserCode]*/
        private SqlDataAdapter Adapter
        {
            get
            {
                if (this._adapter == null)
                {
                    this.InitAdapter();
                }
                return this._adapter;
            }
        }

        /*[DebuggerNonUserCode]*/
        public bool ClearBeforeFill
        {
            get
            {
                return this._clearBeforeFill;
            }
            set
            {
                this._clearBeforeFill = value;
            }
        }

        /*[DebuggerNonUserCode]*/
        protected SqlCommand[] CommandCollection
        {
            get
            {
                if (this._commandCollection == null)
                {
                    this.InitCommandCollection();
                }
                return this._commandCollection;
            }
        }

        /*[DebuggerNonUserCode]*/
        internal SqlConnection Connection
        {
            get
            {
                if (this._connection == null)
                {
                    this.InitConnection();
                }
                return this._connection;
            }
            set
            {
                this._connection = value;
                if (this.Adapter.InsertCommand != null)
                {
                    this.Adapter.InsertCommand.Connection = value;
                }
                if (this.Adapter.DeleteCommand != null)
                {
                    this.Adapter.DeleteCommand.Connection = value;
                }
                if (this.Adapter.UpdateCommand != null)
                {
                    this.Adapter.UpdateCommand.Connection = value;
                }
                for (int i = 0; i < this.CommandCollection.Length; i++)
                {
                    if (this.CommandCollection[i] != null)
                    {
                        this.CommandCollection[i].Connection = value;
                    }
                }
            }
        }
    }
}

